<%@ page import="com.hjl.entity.User" %><%--
  Created by IntelliJ IDEA.
  User: 86176
  Date: 2024/7/25
  Time: 9:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%--<%
    String username = null;
    Cookie[] cookies = request.getCookies();
    if (cookies != null) {
        for (int i = 0; i < cookies.length; i++) {
            if (cookies[i].getName().equals("username")) {
                username = cookies[i].getValue();
            }
        }
    }
%>
你好，<%=username%>--%>
<%--你好${user.username}--%>

<%--安全退出--%>
<%
    User user = (User) request.getSession().getAttribute("user");
    if (user == null) {
        response.sendRedirect("login.html");
    }
%>
${user.username},登陆成功。<a href="/loginOut">安全退出</a>
</body>
</html>
